import { betweenStartEndDays } from "@src/entries/options/generate"
import dayjs from "dayjs"

/** 获取 cookies */
export const getDomCookies = () => {
  return document.cookie
}

/** 获取某日期中的一周的日期 */
export const getWeekDates = (curDate:string) => {
  if(!curDate) return

  let day = dayjs(curDate).day()
  if(day === 0) day = 7

  const startDate = dayjs(curDate).subtract(day - 1, 'day').format('YYYY-MM-DD')
  const endDate = dayjs(startDate).add(6, 'day').format('YYYY-MM-DD')
  
  return betweenStartEndDays(startDate, endDate)
}
